package com.chen.controller;

import com.chen.service.UserService;
import com.chen.vo.Result;
import com.chen.vo.param.UserParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:chenao
 * @DATE:2022/3/6 14:28
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    UserService userService;

    @PostMapping("save")
    public Result userLogin(@RequestBody UserParam userParam){
        return userService.saveUser(userParam);
    }

    @PostMapping("info")
    public Result findUser(@RequestBody UserParam param){
        return Result.success(userService.queryUserById(param.getId()));
    }
}
